const arr = [1, [2, [3, [4, 5,5]]]]
//手写一个递归 扁平化
function bianli(arr) {
    let result=[]
    for (let i = 0; i < arr.length;i++) {
        if (Array.isArray(arr[i])) {
           result.push(...bianli(arr[i]))  
        } else {
            result.push(arr[i])
        }
    }return result
}
//去重
let newArray= bianli(arr);
let mySet = new Set()
for (let i = 0; i < newArray.length; i++){
    mySet.add(newArray[i])
}
console.log(mySet);

